<!--page description, messages-->
<% if @work.unrevealed? %>
  <p class="message">
    <%= ts("This work is part of an ongoing challenge and will be revealed soon! You can find details here: ") %>
    <%= @work.collections.unrevealed.collect {|challenge| link_to(challenge.title, collection_path(challenge))}.join(", ").html_safe %>
  </p>
<% end %>
<!--/descriptions-->

<!--subnav-->
<% if logged_in_as_admin? %>
  <%= render :partial => 'admin/admin_options', :locals => {:item => @work} %>
<% end %>
<!--/subnav-->

<!-- BEGIN revealed -->
<% if !@work.unrevealed? || logged_in_as_admin? || is_author_of?(@work) || (@work.unrevealed? && can_see_work(@work, current_user)) %>
<!-- BEGIN work -->
  <p class="landmark"><a name="top">&nbsp;</a></p>
<!--work description, metadata, notes and messages-->
  <%= render :partial => 'works/work_header' %>
  <% if logged_in_as_admin? %>
    <%= render :partial => 'admin/admin_options', :locals => {:item => @work} %>
  <% end %>
<!--/descriptions-->

<!--chapter content-->
    <div id="chapters" class="userstuff" role="article">
    <h3 class="landmark">Work Text:</h3>
      <% if @chapters && @chapters.size > 1 %>
        <% for chapter in @chapters %>
          <% if chapter.posted? || is_author_of?(chapter) %>
            <%= render :partial => 'chapters/chapter', :locals => {:chapter => chapter, :hide_work_info => true} %>
          <% end %>
        <% end %>
      <% else %>
        <% cache("#{@chapter.cache_key}-show-content") do %>
          <%=raw sanitize_field(@chapter, :content) %>
        <% end %><!-- end cache -->
      <% end %>
    </div>
<!--/chapter-->
    <% unless @work.endnotes.blank? %>
<!--work endnotes-->
      <div class="preface" role="complementary">
        <div id="work_endnotes" class="footnotes">
          <h3><%= ts("Notes:") %></h3>
          <blockquote class="userstuff"><%=raw sanitize_field(@work, :endnotes) %></blockquote>
        </div>
      </div>
<!-- /endnotes-->
    <% end %>
  </div>
<!-- END work skin -->

<!--subnav-->
  <% unless @work.series.blank? %>
    <%= render :partial => 'works/series_links' %>
  <% end %>
  <%= render :partial => 'works/work_footer' %>
<!--/subnav-->
<!-- END work -->

<!-- BEGIN comment section -->
<%= render :partial => 'comments/commentable', :locals => {:commentable => @work} %>
<!-- END comment section -->
<% end %>
<!-- END revealed -->
